def generator_fiboacc():

    # 定义a,b的初始值
    a, b = 0, 1

    while True:
        yield a
        a, b = b, a + b


fib_gen = generator_fiboacc()

# 1 yield a=0
# 2 a = 1 b=1  yeild a=1
# 3 a = 1 b=2  yield a=1
# 4 a = 2 b=3  yield a=2
# 5 a=3,  b=5  yield a=3
# 6 a=5,  b=8  yield a=5
# 7 a=8,  b=13 yield a=8

# 0,1,1,2,3,5,8,13,21,34
for i in range(10):
    print(next(fib_gen))
